<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>图文素材</title>
	<%@include file="/WEB-INF/layouts/index-header.jsp"%>
</head>
<body>

<div class="tpanel">
	<div class="panel-content">
		<div class="container-fluid">
			<div id="tool">
				<form id="searchForm" class="form-inline" onsubmit="return search('#searchForm','#table')" style="margin-top:20px;margin-bottom:20px;">
					<div class="form-group">
						<div class="btn-group">
							<a class="btn btn-success radius" href="${ctx}/admin/wechat/material/article-card/create">
								<span class="glyphicon glyphicon-plus" style="color: white;"></span>新建图文素材
							</a>
							<button type="button" class="btn btn-success dropdown-toggle"
									data-toggle="dropdown">
								<span class="caret"></span>
								<span class="sr-only">切换下拉菜单</span>
							</button>
							<ul class="dropdown-menu" role="menu">
								<li><a href="#">新建分享图文</a></li>
								<li><a href="#">管理图文模版</a></li>
							</ul>
						</div>
					</div>
				</form>
			</div>
			<table id="table"></table>
		</div>
	</div>
</div>

<a href="${ctx}/admin/wechat/material/article-card/test" class="btn btn-success">测试</a>

<script type="text/javascript">
    changeTitle('图文素材');

    $(function() {
        $('.form_datetime').datetimepicker({
            language : 'zh-CN',
            autoclose : true
        });
        $('#table').bootstrapTable({
            url: '${ctx}/admin/wechat/page-list?order=desc&sort=created_time',
            idField : 'id',
            striped : true,
            pagination : true,
            pageNumber : 1,
            pageSize : 25,
            sidePagination : 'server',
            uniqueId : 'id',
            /*checkbox : true,
            clickToSelect : true,*/
            queryParams : queryParams,
            responseHandler : responseHandler,
            columns: [/*{
                field: 'ck',
                checkbox : true
            },*/
                {
                    title: '#',
                    width : 50,
                    align : 'center',
                    valign:'middle',
                    formatter: snFormatter
                },
                {
                    field: 'cover',
                    title: '封面',
                    valign:'middle',
                    align : 'center',
                    formatter : function(value,row,index) {
                        return '<img src="' + value + '" style="width: 100px; height: 100px;">';
                    }
                },
                {
                    field: 'title',
                    title: '标题(点击标题预览)',
                    valign:'middle',
                    align : 'center'
                },
				{
                    field: 'time',
                    title: '时间',
                    valign:'middle',
                    align : 'center'
                },
                {
                    field: 'op',
                    searchable : true,
                    title: '操作',
                    valign:'middle',
                    align : 'center',
                    formatter : operateFormatter
                }],
			data : [
				{
				    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
					"title" : "图文素材",
					"time" : "2017-12-11 00:00:00"
				},
                {
                    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
                    "title" : "图文素材",
                    "time" : "2017-12-11 00:00:00"
                },
                {
                    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
                    "title" : "图文素材",
                    "time" : "2017-12-11 00:00:00"
                },
                {
                    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
                    "title" : "图文素材",
                    "time" : "2017-12-11 00:00:00"
                },
                {
                    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
                    "title" : "图文素材",
                    "time" : "2017-12-11 00:00:00"
                },
                {
                    "cover" : "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2204714399,1444377312&fm=27&gp=0.jpg",
                    "title" : "图文素材",
                    "time" : "2017-12-11 00:00:00"
                }
			]
        });

    });

    function operateFormatter(value,row,index) {
        var content = '<a href="${ctx}/admin/wechat/message/update?id=' + row.id + '" title="编辑"><i class="iconfont icon-iconfontcolor32"></i></a>';
        content += '&nbsp;&nbsp;&nbsp;&nbsp;';
        content += '<a href="javascript:del(' + row.id + ')" title="删除"><i class="iconfont icon-shanchu"></i></a>';
        return content;
    }
    function del(id,name) {
        carefulDelete('${ctx}/admin/wechat/message/careful-delete',id,'请输入您的管理密码以确定删除此系统资源');
    }
</script>

</body>
</html>
